load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//pkg/testutils:buildutil/buildutil.bzl", "disallowed_imports_test")

go_library(
    name = "flowinfra",
    srcs = [
        "flow.go",
        "flow_registry.go",
        "inbound.go",
        "outbox.go",
        "remote_flow_runner.go",
        "stream_decoder.go",
        "stream_encoder.go",
        "testing_knobs.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/flowinfra",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/kv",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/sql/catalog/catenumpb",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/execinfra",
        "//pkg/sql/execinfra/execopnode",
        "//pkg/sql/execinfra/execreleasable",
        "//pkg/sql/execinfrapb",
        "//pkg/sql/memsize",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/rowenc",
        "//pkg/sql/sem/tree",
        "//pkg/sql/types",
        "//pkg/util/admission",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/buildutil",
        "//pkg/util/cancelchecker",
        "//pkg/util/ctxlog",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/optional",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_gogo_protobuf//proto",
        "@io_opentelemetry_go_otel//attribute",
    ],
)

go_test(
    name = "flowinfra_test",
    size = "medium",
    srcs = [
        "cluster_test.go",
        "flow_registry_test.go",
        "flow_test.go",
        "main_test.go",
        "outbox_test.go",
        "server_test.go",
        "stream_data_test.go",
        "utils_test.go",
    ],
    embed = [":flowinfra"],
    deps = [
        "//pkg/base",
        "//pkg/ccl/kvccl/kvtenantccl",
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/concurrency/isolation",
        "//pkg/kv/kvserver/kvserverbase",
        "//pkg/multitenant/tenantcapabilities",
        "//pkg/roachpb",
        "//pkg/rpc",
        "//pkg/rpc/nodedialer",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/fetchpb",
        "//pkg/sql/distsql",
        "//pkg/sql/execinfra",
        "//pkg/sql/execinfrapb",
        "//pkg/sql/parser",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/randgen",
        "//pkg/sql/rowenc",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/sqlstats",
        "//pkg/sql/types",
        "//pkg/testutils",
        "//pkg/testutils/distsqlutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/cancelchecker",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/timeutil",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_stretchr_testify//require",
    ],
)

disallowed_imports_test(
    "flowinfra",
    ["//pkg/sql/distsql"],
)
